/*
 * @Date: 2024-12-03 15:27:54
 * @Author: LiSong
 * @LastEditors: LiSong
 * @LastEditTime: 2024-12-03 15:27:56
 * @Description: 
 */
/*
 * @Date: 2024-12-02 11:32:21
 * @Author: LiSong
 * @LastEditors: LiSong
 * @LastEditTime: 2024-12-02 11:34:20
 * @Description: 
 */

// 已知的一些字段
const knownKeys = [ 'name', 'arity', 'length', 'caller', 'callee', 'arguments', 'prototype' ]

export default {
  /**
   * 获取类中的静态数据定义
   * 
   * @param {Object} _obj 
   * @param {Boolean} isObj 是否获取静态对象数据：true-是 false-否（返回静态的KEY）
   * @returns 
   */
  getOwnPropertyStatics : function (_obj, isObj=false) {
    let result = [];
    const ownNames = Object.getOwnPropertyNames(_obj);
    const ownSymbols = Object.getOwnPropertySymbols(_obj)
    const ownAllKeys = ownNames.concat(ownSymbols)
    for (let key of ownAllKeys) {
      if (knownKeys.includes(key)) continue;
      if (typeof _obj[key] === 'function') continue;
      result.push(isObj ? _obj[key] : key)
    }
    return result;
  }
}
